package com.neuedu.hcp.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.neuedu.hcp.entity.RespPageBean;
import com.neuedu.hcp.entity.Steward;
import com.neuedu.hcp.mapper.StewardMapper;
import com.neuedu.hcp.service.IStewardService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 第八组
 * @since 2021-04-26
 */
@Service
public class StewardServiceImpl extends ServiceImpl<StewardMapper, Steward> implements IStewardService {

    @Autowired
    private StewardMapper stewardMapper;

    @Override
    public RespPageBean getPlanListByPage(Integer currentPage, Integer size, Steward steward) {
        Page<Steward> page = new Page<>(currentPage,size);
        IPage<Steward> stewardByPage =stewardMapper.getPlanListByPage(page,steward);
        RespPageBean respPageBean = new RespPageBean(stewardByPage.getTotal(),stewardByPage.getRecords());
        return respPageBean;
    }



    @Override
    public int insert(Steward steward) {
        return stewardMapper.insert(steward);
    }
}
